/**
 * sysPlateformInfoServiceImpl
 * 项目名称:分秒金融
 *
 * @author lunli
 *
 * 功能描述:平台信息设置管理
 * 
 * 历史版本:2017-03-27 v1.0.0 lunli  创建:
 * 
 */
package com.fmjr.sys.sysPlateformInfo.service.impl;

import com.fmjr.common.base.exception.BusinessException;
import com.fmjr.sys.sysPlateformInfo.bean.SysPlateformInfo;
import com.fmjr.sys.sysPlateformInfo.dao.SysPlateformInfoDao;
import com.fmjr.sys.sysPlateformInfo.service.ISysPlateformInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;


@Service("sysPlateformInfoService")
@CacheConfig(cacheNames = "fmjrCache")
public class  SysPlateformInfoServiceImpl implements ISysPlateformInfoService {
	

	@Autowired
    private SysPlateformInfoDao sysPlateformInfoDao;

	

	
	/**
	 * 修改平台信息设置记录
	 * @author lunli
	 * @param sysPlateformInfo
	 * @throws BusinessException
	 */
	@Transactional(rollbackFor=BusinessException.class)
	@CachePut(key="'updateSysPlateformInfo'")
	public SysPlateformInfo updateSysPlateformInfo(SysPlateformInfo sysPlateformInfo) throws BusinessException{
		sysPlateformInfo.setUpdateDate(new Date());
		sysPlateformInfoDao.updateSysPlateformInfoSelective(sysPlateformInfo);
		return  sysPlateformInfo;
	}

	/**
	 * 新增平台信息设置记录
	 * @author lunli
	 * @param sysPlateformInfo
	 * @return
	 * @throws BusinessException
	 */
	@Transactional(rollbackFor=BusinessException.class)
	@CachePut(key="'updateSysPlateformInfo'")
	public SysPlateformInfo createSysPlateformInfo(SysPlateformInfo sysPlateformInfo) throws BusinessException{
		sysPlateformInfo.setCreateDate(new Date());
		sysPlateformInfoDao.createSysPlateformInfo(sysPlateformInfo);
		return  sysPlateformInfoDao.selectSysPlateformInfo();
		
	}

	@Override
	@Cacheable(key="'updateSysPlateformInfo'")
	public SysPlateformInfo selectSysPlateformInfo() throws BusinessException {
		return  sysPlateformInfoDao.selectSysPlateformInfo();
	}
	

	

}
